package com.timesheet.server.dao;

import java.util.ArrayList;
import java.util.List;

import com.timesheet.server.common.models.ProjectDTO;
import com.timesheet.server.core.dao.BaseDao;
import com.timesheet.server.core.mapper.Mapper;
import com.timesheet.server.core.models.Project;

public class ProjectDao extends BaseDao {

	public boolean createProject(ProjectDTO projectDTO) {

		Mapper<Project> mapper = new Mapper<Project>();
		Project project = mapper.map(new Project(), projectDTO);
		return persist(project);

	}

	public List<ProjectDTO> getProjects() {
		List<ProjectDTO> projectDto = new ArrayList<ProjectDTO>();
		/*List list = createQuery("select p from Project p");
		for(Object obj  : list){
			
			Project  project = (Project) obj ;			
			ProjectDTO dto = new ProjectDTO();
			dto.setProjectId(project.getProjectId());
			dto.setProjectName(project.getProjectName());
			projectDto.add(dto);
		}*/
		return projectDto;
	}

}
